package thread;

public class ThreadDemo2 {
    public static void main(String[] args) {
        Runnable rb1 = new MyRunnbale1();
        Runnable rb2 = new MyRunnbale2();
        Thread td1 = new Thread(rb1);
        Thread td2 = new Thread(rb2);
        td1.start();
        td2.start();

    }
}
class MyRunnbale1 implements Runnable{

    @Override
    public void run() {
        for (int i = 0; i < 1000; i++) {
            System.out.println("开门");
        }
    }
}
class MyRunnbale2 implements Runnable{

    @Override
    public void run() {
        for (int i = 0; i < 1000; i++) {
            System.out.println("查水表的");
        }
    }
}